# environment vars from build.sh:
#   ISO_TITLE
#   ISO_INIT
#   ISO_GUI
#   ENABLE_OFFLINE_INSTALL
#   HAS_BRLTTY_TTS


readonly LOCALES="en_US\.UTF-8 \
                  eo           \
                  es_ES\.UTF-8 \
                  fr_FR\.UTF-8 \
                  gl_ES\.UTF-8 \
                  it_IT\.UTF-8 \
                  pt_BR\.UTF-8 \
                  pl_PL\.UTF-8 "

readonly SYSTEMD_DELETE_FILES="/etc/conf.d/agetty.tty1 \
                               /etc/conf.d/hostname    \
                               /etc/init.d/pacman-init \
                               /etc/X11/Xwrapper.config"
readonly OPENRC_DELETE_FILES="/etc/hostname                                           \
                              /etc/systemd/scripts/choose-mirror                      \
                              /etc/systemd/system/choose-mirror.service               \
                              /etc/systemd/system/etc-pacman.d-gnupg.mount            \
                              /etc/systemd/system/getty@tty1.service.d/autologin.conf \
                              /etc/systemd/system/pacman-init.service                 "

readonly SYSTEMD_SERVICES_ALL="choose-mirror.service \
                               multi-user.target     \
                               pacman-init.service   "
readonly SYSTEMD_SERVICES_ACC="bluetooth.service           \
                               brltty.service              \
                               livecd-alsa-unmuter.service "
readonly SYSTEMD_SERVICES_GUI="NetworkManager.service"
readonly OPENRC_SERVICES_ALL="dbus           \
                              haveged        \
                              NetworkManager \
                              pacman-init    "
readonly OPENRC_SERVICES_GUI="alsasound \
                              elogind   "
readonly SYSTEMD_SERVICES="${SYSTEMD_SERVICES_ALL}"
readonly OPENRC_SERVICES="${OPENRC_SERVICES_ALL}"
[[ "${ENABLE_TTS_BRLTTY}" == 'yes' ]] && readonly SYSTEMD_SERVICES+=" ${SYSTEMD_SERVICES_ACC}"
[[ "${ISO_GUI}"           != 'cli' ]] && readonly SYSTEMD_SERVICES+=" ${SYSTEMD_SERVICES_GUI}"
[[ "${ISO_GUI}"           != 'cli' ]] && readonly OPENRC_SERVICES+=" ${OPENRC_SERVICES_GUI}"

readonly DEFAULT_SHELL=/bin/bash

readonly NETINSTALL_MSG="To install Parabola, the system must be connected to the internet."
readonly COMPLETE_MSG="This ISO is capable of installing a complete Parabola system\n\
    without a connection to the internet.\n\
    To fetch packages from the internet, enter this command first:\n\
        [01;37m# cp /etc/pacman-online.conf /etc/pacman.conf[0m"
if   [[ "${ENABLE_OFFLINE_INSTALL}" == 'true' ]]
then readonly INSTALL_TYPE='Complete'   ; readonly NETWORK_MOTD_MSG=${COMPLETE_MSG}   ;
else readonly INSTALL_TYPE='NetInstall' ; readonly NETWORK_MOTD_MSG=${NETINSTALL_MSG} ;
fi

readonly ROOT_SKEL_FILES="/etc/skel/.bash_logout           \
                          /etc/skel/.bash_profile          \
                          /etc/skel/install-openrc-lxde.sh \
                          /etc/skel/install-systemd-mate.sh"

readonly LIVE_USER=parabola
readonly LIVE_USER_GROUPS="adm,audio,floppy,log,network,rfkill,scanner,storage,optical,power,wheel"
readonly OPENRC_USER_GROUPS="disk,sys"
[[ "${ISO_INIT}" == 'openrc' ]] && readonly USER_GROUPS="${LIVE_USER_GROUPS},${OPENRC_USER_GROUPS}" ||
                                   readonly USER_GROUPS="${LIVE_USER_GROUPS}"

readonly OS_PRETTY_NAME="$(echo ${ISO_TITLE}      | cut -d ' ' -f -5) - (${INSTALL_TYPE})"
readonly OS_VERSION=$(     echo ${ISO_TITLE}      | cut -d ' ' -f  6                    )
readonly OS_VERSION_ID=$(  echo ${ISO_TITLE}      | cut -d ' ' -f  6                    )
readonly OS_VARIANT="$(    echo ${OS_PRETTY_NAME} | cut -d ' ' -f -3 --complement       )"
readonly OS_VARIANT_ID=${ISO_INIT}-${ISO_GUI}


LOG_CONFIG() { printf "\033[01;34mconfiguring: %s\033[00m\n" "$(echo -e $*)" ; }
